package org.jeecg.modules.employee.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.employee.entity.Employee;
import org.jeecg.modules.employee.mapper.EmployeeMapper;
import org.jeecg.modules.employee.service.IEmployeeService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @Description: 员工信息表
 * @Author: jeecg-boot
 * @Date:   2025-01-16
 * @Version: V1.0
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {

    @Override
    public List<Employee> listByDeptIds(String id) {
        LambdaQueryWrapper<Employee> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(Employee::getClasses, id);
        wrapper.eq(Employee::getDisable, 0);
        return baseMapper.selectList(wrapper);
    }

    @Override
    public Employee getByAdmitGuid(String admitGuid) {
        LambdaQueryWrapper<Employee> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(Employee::getAdmitGuid, admitGuid);
        wrapper.last("limit 1");
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public List<Map<String, Object>> getCenter1() {
        return baseMapper.getCenter1();
    }

    @Override
    public List<Map<String, Object>> getLeft3() {
        return baseMapper.getLeft3();
    }

    @Override
    public List<Employee> deptNameList() {
        return baseMapper.deptNameList();
    }

}
